package com.init.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.init.model.entity.Items;
import com.init.service.ItemsService;
import com.init.mapper.ItemsMapper;
import org.apache.commons.lang3.StringUtils;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * 评定详细
* @author Atanycosts
* @description 针对表【assessmentitems(存储评定内容信息)】的数据库操作Service实现
* @createDate 2025-01-04 08:55:15
*/
@Service
public class ItemsServiceImpl extends ServiceImpl<ItemsMapper, Items>
    implements ItemsService {

    @Resource
    @Lazy
    private ItemsService itemsService;


    /**
     * 分页查询
     *
     * @param page
     * @param pageSize
     * @param content
     * @return
     */
    @Override
    public Page queryPage(int page, int pageSize, String content) {
        // 构造分页构造器
        Page pageInfo = new Page(page, pageSize);

        // 构造条件构造器
        LambdaQueryWrapper<Items> queryWrapper = new LambdaQueryWrapper();

        // 添加过滤条件,模糊查询

        queryWrapper.like(StringUtils.isNotEmpty(content), Items::getContent, content);

        // 添加排序条件
        queryWrapper.orderByDesc(Items::getItemId);

        // 执行查询
        itemsService.page(pageInfo, queryWrapper);
        return pageInfo;
    }
}




